# c:\python27\python
from math import sqrt
def isprime(y):
    x=int(sqrt(y))
    if y==1:
        return False
    elif y<4:
        return True
    elif y%2==0:
        return False
    elif y<9:
        return True
    elif y%3==0:
        return False
    else:
        f=5
        while f<=x:
            if y%f==0:
                return False
            if y%(f+2)==0:
                return False
            f=f+6
        else:
            return True
count=1
y=3
while True:
    if isprime(y):
    	count=count+1
    y=y+2
    if count==10001:
        break
print y


    




